package com.vinoxm.rss.controller;

import com.vinoxm.common.base.result.BaseResult;
import com.vinoxm.common.core.controller.BaseController;
import com.vinoxm.rss.model.RssDetail;
import com.vinoxm.rss.service.RssDetailService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

public abstract class RssDetailController<T extends RssDetailService<?, U>, U extends RssDetail> extends BaseController<T>  {

    @GetMapping("getMany")
    public BaseResult getMany(Long pid) {
        return baseService.getManyByPid(pid);
    }

    @PostMapping("editOne")
    public BaseResult editOne(@RequestBody U rssDetail) {
        return baseService.editOne(rssDetail);
    }

    @PostMapping("addOne")
    public BaseResult addOne(@RequestBody U rssDetail) {
        return baseService.addOne(rssDetail);
    }

    @GetMapping("delOne")
    public BaseResult delOne(Long id) {
        return baseService.delOne(id);
    }

    @GetMapping("delMany")
    public BaseResult delMany(Long pid){
        return baseService.delManyByPid(pid);
    }
}
